<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

    <input type="text" name="src">
    <label for="uploader-input">上传</label>

    <script src="Public/static/js/jquery.min.js"></script>
    <script src="Public/static/js/ycom.js"></script>

    <script>
        var uploader = Ycom.Uploader();
        uploader.init(function() {
            uploader.objs.input.change(function() {
                Ycom.loading.show();
                uploader.send();
            });
        }, function(r) {
            Ycom.loading.hide();
            var result = $.parseJSON(r);
            if (result.code == 'ok') {
                $('input[name=src]').val(result.src);
            } else {
                alert(result.msg);
            }
        }, {
            form: 'uploader-form',
            frame: 'uploader-frame',
            input: 'uploader-input',
            formAction: '<{:U("upload")}>',
            fileType: 'image/jpeg, image/jpg',
            // fileType: 'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        });
    </script>
</body>
</html>
